﻿using System;

using CARMSBusiness;
 

namespace CARMS.Admin
{
    [Function("Admin.ChangePassword")]
    public partial class ChangePassword : PageBase
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        } 
        protected void btnSave_Click(object sender, EventArgs e)
        {
            var data = SecurityBusiness.GetUserByID(CurrentLoginUser.UserID);
            if (data.Password !=txtOldPassword.Text.Trim())
            {
                Alert("Original password is incorrect !");
            }
            else
            {
                if (SecurityBusiness.ChangePassword(CurrentLoginUser.UserID, txtNewPassword.Text.Trim()))
                {
                    base.Alert("Password modified successfully !");
                }

                else
                {
                    base.Alert("Password modified failed !");
                }
            }
        }
    }
}
